# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=tiger
pkgver=3.2.3
pkgrel=10
groups=('blackarch' 'blackarch-automation' 'blackarch-scanner')
pkgdesc='A security scanner, that checks computer for known problems. Can also use tripwire, aide and chkrootkit.'
arch=('x86_64' 'aarch64')
url='http://www.nongnu.org/tiger/'
license=('GPL')
depends=('perl')
makedepends=('patch')
backup=('etc/tiger/tigerrc' 'etc/tiger/cronrc')
source=("http://download.savannah.gnu.org/releases/$pkgname/$pkgname-$pkgver.tar.gz"
        'tiger-makefile.diff'
        'build-fix.diff')
sha512sums=('d0b8326ff0a0159aa99e794f114769c56d520c35a48c16d53d2ca90132ac32614fe84ae661f9ad61aa943ce8171b6051a0495e838e19447e1c34f26d5b730d73'
            '79d9d514ee6ce8a30e68fb6ea6c751d21454321cbb96134dc65e66e34edc6c535b40068bc9138140742be0134f2e1961f3425af352caeab34b3363b4b90accde'
            'c9105cdedb8de5a7b3485f95e342f7aa70071724534f96c11bb4752c0c48e1610791d85922a79671d42698902923f30cec84055bb20e9987f06f10db3a1c166e')

prepare() {
  cd "$pkgname-$pkgver"

  patch -Np0 -i "$srcdir/tiger-makefile.diff"
  patch -Np0 -i "$srcdir/build-fix.diff"
}

build() {
  cd "$pkgname-$pkgver"

  ./configure --prefix=/usr \
    --mandir=/usr/share/man \
    --with-tigerhome=/usr/share/tiger \
    --with-tigerconfig=/etc/tiger \
    --with-tigerwork=/var/run/tiger \
    --with-tigerlog=/var/log/tiger \
    --with-tigerbin=/usr/bin

  make
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -aR tiger "$pkgdir/usr/share/$pkgname/"

  ln -s "/usr/share/$pkgname/$pkgname" "$pkgdir/usr/bin/"
}

